package cn.itsource.pethome.base.service.impl;

import cn.itsource.pethome.base.mapper.BaseMapper;
import cn.itsource.pethome.base.query.BaseQuery;
import cn.itsource.pethome.base.service.IBaseService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;
@Transactional(readOnly = true,propagation = Propagation.SUPPORTS)
public class IBaseServiceImpl<T> implements IBaseService<T> {
    @Autowired
    private BaseMapper<T> beasMapper;
    @Transactional
    @Override
    public void add(T t) {
        beasMapper.add(t);
    }
    @Transactional
    @Override
    public void delete(Long id) {
        beasMapper.delete(id);
    }
    @Transactional
    @Override
    public void update(T t) {
        beasMapper.update(t);
    }

    @Override
    public T findnoe(Long id) {
        return  beasMapper.findnoe(id);
    }

    @Override
    public List<T> findAll() {
        return beasMapper.findAll();
    }

    @Override
    public Long queryCount(BaseQuery query) {
        return beasMapper.queryCount(query);
    }

    @Override
    public List<T> queryData(BaseQuery query) {
        return beasMapper.queryData(query);
    }
    @Transactional
    @Override
    public void batchDel(List ids) {
        beasMapper.batchDel(ids);
    }
}
